<?php

/**
 * Class qui va gerer les utilisateurs
 *
 * @author iLyas
 */
class Profile extends CI_Controller {
        
    function __construct() {
        parent::__construct();
        //check if user is logged in
        $this->is_logged_in();
    }
    
    function index() {
        $this->members_area();
    }
  
    function members_area(){
       
        $this->load->model('user_model');
        $this->load->model('page_model');
        $this->load->model('dashboard_model');
        
      
        //Fetch User Page records
        if ($q = $this->page_model->get_user_pages($this->session->userdata('user_id'))) {
            $data['pages_records'] = $q;
        }
        
        //Fetch user records
        $data['userInfo'] = $this->user_model->getUserRecords($this->session->userdata('user_id'));
        
        $this->load->view('user/dashboard', $data);        
    }
    
    function show_pages_table(){
        
        

    }
    
    function is_logged_in(){
        $is_logged_in = $this->session->userdata('is_logged_in');
        
        if(!(isset($is_logged_in)) || $is_logged_in != TRUE){
             redirect('/user/login/', 'refresh');
        }
    }
    
}

?>